﻿@model HQPad.Models.RecordItem
           
@{
    Layout = "~/Views/Shared/_ModalLayout.cshtml";
}

<script src="@Url.Content("~/Scripts/jquery-ui-1.10.3.custom.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/global.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/character.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('.modal-content').character({
            updateRecordItemUrl: '@Url.Action("UpdateRecord","Character", new { id = Model.ID }, null)',
            updateRecordCallback: function () {
                parent.closeModalAndRefresh();
            }
        });
    });
</script>

<h1>Edit adventure record</h1>

<section class="modal-content">
    <div class="add-record form">
        @using (Html.BeginForm("UpdateRecord", "Character", FormMethod.Post, new { @name = "updateRecordForm", @id = "updateRecordForm" }))
        {
        <input type="hidden" id="eventItem" name="eventItem" value="@Html.Raw(Model.ID.ToString())" />  
        <div class="field-item">
            <div class="label"><label for="eventDate">Date:</label></div>
            <input type="datetime" id="eventDate" name="eventDate" class="date-time" value="@Html.Raw(Model.Date.ToString("dd/MM/yyyy"))" />
            <span class="date-error"></span>
        </div>
        <div class="field-item">
            <div class="label"><label for="eventDescription">Event:</label></div>
            <input type="text" id="eventDescription" name="eventDescription" class="textbox" value="@Html.Raw(Model.Description)" />
        </div>
        <div class="field-item">
            <div class="label"><label for="eventPoints">Points:</label></div>
            <input type="number" id="eventPoints" name="eventPoints" class="number" min="1" max="9999" value="@Html.Raw(Model.Points.ToString())" />
            <span class="points-error"></span>
        </div>
        <input type="submit" value="Update" />
        }
    </div>

    <div class="message-box"></div>
</section>